From: Timo Röhling Date: Tue, 22 Nov 2022 20:43:39 +0000 (+0100) Subject: Improve epoxy patch X-Git-Tag: archive/raspbian/1.9.25+dfsg3-1+rpi1^2~44 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=2a9128ca89a311ae7c485522fedcd6a7b3a90502;p=filament.git Improve epoxy patch Gbp-Dch: ignore --- diff --git a/debian/patches/0011-Replace-BlueGL-with-epoxy.patch b/debian/patches/0011-Replace-BlueGL-with-epoxy.patch index 35d142b..6e7c9ee 100644 --- a/debian/patches/0011-Replace-BlueGL-with-epoxy.patch +++ b/debian/patches/0011-Replace-BlueGL-with-epoxy.patch @@ -5,12 +5,14 @@ Subject: Replace BlueGL with epoxy --- CMakeLists.txt | 1 - filament/backend/CMakeLists.txt | 8 +- + filament/backend/src/opengl/OpenGLBlitter.cpp | 2 +- filament/backend/src/opengl/OpenGLContext.cpp | 4 +- - filament/backend/src/opengl/OpenGLDriver.cpp | 4 +- + filament/backend/src/opengl/OpenGLDriver.cpp | 14 ++- + filament/backend/src/opengl/OpenGLDriver.h | 1 + filament/backend/src/opengl/PlatformGLX.cpp | 151 +++----------------------- filament/backend/src/opengl/PlatformGLX.h | 4 +- filament/backend/src/opengl/gl_headers.h | 2 +- - 7 files changed, 28 insertions(+), 146 deletions(-) + 9 files changed, 36 insertions(+), 151 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a95c557..5c117c3 100644 @@ -52,6 +54,19 @@ index f61faee..360471f 100644 endif() # ================================================================================================== +diff --git a/filament/backend/src/opengl/OpenGLBlitter.cpp b/filament/backend/src/opengl/OpenGLBlitter.cpp +index f1a7f70..ee7682a 100644 +--- a/filament/backend/src/opengl/OpenGLBlitter.cpp ++++ b/filament/backend/src/opengl/OpenGLBlitter.cpp +@@ -73,7 +73,7 @@ void OpenGLBlitter::init() noexcept { + GLint status; + char const* vsource[2] = { s_vertexES, s_vertexGL }; + char const* fsource[2] = { s_fragmentES, s_fragmentGL }; +- const size_t index = GLES30_HEADERS ? 0 : 1; ++ const size_t index = epoxy_is_desktop_gl() ? 1 : 0; + + mVertexShader = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(mVertexShader, 1, vsource + index, nullptr); diff --git a/filament/backend/src/opengl/OpenGLContext.cpp b/filament/backend/src/opengl/OpenGLContext.cpp index 62aa98f..01a4e24 100644 --- a/filament/backend/src/opengl/OpenGLContext.cpp @@ -75,10 +90,42 @@ index 62aa98f..01a4e24 100644 shaderModel = ShaderModel::GL_CORE_41; } diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp -index 9b7135f..5ccf074 100644 +index 9b7135f..4b7c13a 100644 --- a/filament/backend/src/opengl/OpenGLDriver.cpp +++ b/filament/backend/src/opengl/OpenGLDriver.cpp -@@ -974,7 +974,7 @@ void OpenGLDriver::framebufferTexture(backend::TargetBufferInfo const& binfo, +@@ -82,6 +82,7 @@ Driver* OpenGLDriver::create( + assert_invariant(platform); + OpenGLPlatform* const ec = platform; + ++ bool isDesktopGL = epoxy_is_desktop_gl(); + { + // here we check we're on a supported version of GL before initializing the driver + GLint major = 0, minor = 0; +@@ -95,13 +96,13 @@ Driver* OpenGLDriver::create( + return {}; + } + +- if (GLES30_HEADERS) { ++ if (!isDesktopGL) { + // we require GLES 3.1 headers, but we support GLES 3.0 + if (UTILS_UNLIKELY(!(major >= 3 && minor >= 0))) { + PANIC_LOG("OpenGL ES 3.0 minimum needed (current %d.%d)", major, minor); + goto cleanup; + } +- } else if (GL41_HEADERS) { ++ } else { + // we require GL 4.1 headers and minimum version + if (UTILS_UNLIKELY(!((major == 4 && minor >= 1) || major > 4))) { + PANIC_LOG("OpenGL 4.1 minimum needed (current %d.%d)", major, minor); +@@ -111,6 +112,7 @@ Driver* OpenGLDriver::create( + } + + OpenGLDriver* const driver = new OpenGLDriver(ec); ++ driver->mIsDesktopGL = isDesktopGL; + return driver; + } + +@@ -974,7 +976,7 @@ void OpenGLDriver::framebufferTexture(backend::TargetBufferInfo const& binfo, // This extension only exists on OpenGL ES. gl.bindFramebuffer(GL_FRAMEBUFFER, rt->gl.fbo); if (any(t->usage & TextureUsage::SAMPLEABLE)) { @@ -87,7 +134,7 @@ index 9b7135f..5ccf074 100644 attachment, target, t->gl.id, binfo.level, rt->gl.samples); } else { glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, -@@ -1073,7 +1073,7 @@ void OpenGLDriver::renderBufferStorage(GLuint rbo, GLenum internalformat, uint32 +@@ -1073,7 +1075,7 @@ void OpenGLDriver::renderBufferStorage(GLuint rbo, GLenum internalformat, uint32 auto& gl = mContext; if (gl.ext.EXT_multisampled_render_to_texture || gl.ext.EXT_multisampled_render_to_texture2) { @@ -96,6 +143,36 @@ index 9b7135f..5ccf074 100644 } else #endif { +@@ -2329,7 +2331,7 @@ void OpenGLDriver::beginRenderPass(Handle rth, + + // glInvalidateFramebuffer appeared on GLES 3.0 and GL4.3, for simplicity we just + // ignore it on GL (rather than having to do a runtime check). +- if (GLES30_HEADERS) { ++ if (!mIsDesktopGL) { + if (!gl.bugs.disable_invalidate_framebuffer) { + std::array attachments; // NOLINT + GLsizei attachmentCount = getAttachments(attachments, rt, discardFlags); +@@ -2397,7 +2399,7 @@ void OpenGLDriver::endRenderPass(int) { + + // glInvalidateFramebuffer appeared on GLES 3.0 and GL4.3, for simplicity we just + // ignore it on GL (rather than having to do a runtime check). +- if (GLES30_HEADERS) { ++ if (!mIsDesktopGL) { + if (!gl.bugs.disable_invalidate_framebuffer) { + // we wouldn't have to bind the framebuffer if we had glInvalidateNamedFramebuffer() + gl.bindFramebuffer(GL_FRAMEBUFFER, rt->gl.fbo); +diff --git a/filament/backend/src/opengl/OpenGLDriver.h b/filament/backend/src/opengl/OpenGLDriver.h +index 7a8c734..30c8db1 100644 +--- a/filament/backend/src/opengl/OpenGLDriver.h ++++ b/filament/backend/src/opengl/OpenGLDriver.h +@@ -431,6 +431,7 @@ private: + // timer query implementation + TimerQueryInterface* mTimerQueryImpl = nullptr; + bool mFrameTimeSupported = false; ++ bool mIsDesktopGL = false; + }; + + // ------------------------------------------------------------------------------------------------ diff --git a/filament/backend/src/opengl/PlatformGLX.cpp b/filament/backend/src/opengl/PlatformGLX.cpp index b5cb484..32c16d8 100644 --- a/filament/backend/src/opengl/PlatformGLX.cpp